PHP: Can a constructor return a value?
Class a{ function construct () { return ' abc '; }}
May I?
Looks like it's not going to work. 、、、 forgot, no idea.
You can write that, but new will still be the object of this class.
Php constructor and Destructor php memory management function
Class person {
Var $ name;
Var $ age;
Function _ construct () {// Constructor
$ This-> name = "lisi ";
$ This-> age = 28;
Laravel constructor automatically relies on the injection method. Laravel implements the constructor's automatic dependency injection method. the laravel constructor describes how Laravel implements automatic dependency injection for constructor.
Php constructor and Destructor. Constructor and Destructor in php are both used in classes. next I will introduce in detail the methods for using constructor and Destructor in php classes, A friend who needs to know about constructor and Destructor
PHP, a nested abbreviated name, is an abbreviation for the English Super Text preprocessing language (Php:hypertext preprocessor). PHP is an HTML embedded language, PHP and Microsoft's ASP quite a bit similar, is a server-side implementation of
Everyone is rightIf you declare a function in a class and name it _ construct, this function will be treated as a constructor and executed when an object instance is created. Clearly, __is two underscores. Like any other function, PHP 5.0
Php implements parent to call the constructor and overwriting methods of the parent class. Php implements the constructor and overwriting methods for parent to call the parent class. This article mainly introduces the constructor and overwriting
Section 4: constructor and Destructor. + Tips + | this document is for Haohappy to read CorePHPProgramming | the notes in chapter ClassesandObjects in. | mainly translated + personal heart + tips +
| = This article is Haohappy read
>
| = Notes
Section 4 constructor and Destructor [4]. If you declare a function in a class and name it _ construct, this function will be treated as a constructor and executed when an object instance is created. specifically, __is two strokes. if you declare a
PHP is still more commonly used, so I studied the PHP constructor, here to take out and share with you, hope to be useful to everyone. If you declare a function in a class named __construct, the function will be treated as a constructor and executed
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.